package com.zr.utils.page;

import io.swagger.annotations.ApiModelProperty;
import org.springframework.stereotype.Component;

/**
 * @ClassName PlanClassVo
 * @Description 计划大类Vo类
 * @Author 马家奎
 * @Date 2019/11/7 19:08
 */
@Component
public class PageParameterUtil {
    /**
    *当前页
    */
    @ApiModelProperty(required = true,name = "pageIndex", value = "当前页")
    private Integer pageIndex;
    /**
    *每页大小
    */
    @ApiModelProperty(required = true,name = "pageIndex", value = "每页大小" )
    private Integer pageSize;
    /**
    *每页的第一条记录
    */
    private Integer index;

    public Integer getPageIndex() {

        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
        initParamter();

    }

    public void initParamter() {
        if (this.pageIndex == null||this.pageIndex<1) {
            this.pageIndex = 1;
        }
        if (this.pageSize == null ||this.pageSize==0) {
            this.pageSize = 10;
        }
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }

    @Override
    public String toString() {
        return "PageParameterUtil{" +
                "pageIndex=" + pageIndex +
                ", pageSize=" + pageSize +
                ", index=" + index +
                '}';
    }
}
